/*
* PROJECT: Happy New Year
* VERSION: 1.0
* AUTHOR: Mattias Thell
* URL: http://www.mattiasthell.com
*
* */

#include "SpecialRocket.hpp"
#include "Settings.hpp"
#include "ActorManager.hpp"
#include "TargetRocket.hpp"

namespace hny
{

	SpecialRocket::SpecialRocket(World* world, const hgeVector& position, const hgeVector& velocity, int score, const hgeParticleSystemInfo& info)
		:Rocket(world, position, velocity, score, info)
	{
	}

	SpecialRocket::~SpecialRocket()
	{
	}

	void SpecialRocket::OnDeath()
	{
		hgeVector pos = GetPosition();

		int w = Settings::GetInstance()->SystemScreenWidth;
		int h = Settings::GetInstance()->SystemScreenHeight;
		int hw = w/2;
		int hh = h/2;

		hgeVector mirror(w - pos.x, h - pos.y);

		hgeVector vel = mirror - pos;
		vel.Normalize();
		vel *= Settings::GetInstance()->DualRocketVelocity;

		hgeParticleSystemInfo info = Settings::GetInstance()->DualRocketParticleInfo;

		int score = Settings::GetInstance()->DualRocketScore;
		ActorType sr(new TargetRocket(GetWorld(), GetPosition(), vel, score, info, mirror));
		ActorManager::GetInstance()->AddActor(sr);

	}
}